{% extends 'admin-v2/layout.html.twig' %}

{% do script(['libs/jquery-validation.js', 'app/js/admin-v2/operating/certificate-template/step-four/index.js']) %}

{% set menu = 'admin_v2_certificate_template_manage' %}

{% block main %}
  <h4 class="mtl mbl">{{ 'admin.operation_certificate.template.create'|trans }}——{{ 'admin.operation_certificate.template.content.edit'|trans }}</h4>
  <form id="certificate-template-form" class="form-horizontal mtxl" method="post" data-auto-submit="true" data-have-base-fields="true" action="{{ path('admin_v2_certificate_template_creat_step_four', {id:template.id}) }}">
    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="certificateName" class="control-label-required">{{ 'admin.operation_certificate.template.certificate.title'|trans }}：</label>
      </div>
      <div class="col-md-5 controls">
        <input type="text" id="certificateName" name="certificateName" class="form-control" value="{{ template.certificateName|default(('admin.operation_certificate.template.certificate.title.default')|trans) }}">
        <p class="help-block">{{ 'admin.operation_certificate.template.certificate.title_hint'|trans }}</p>
      </div>
    </div>
    <div class="form-group ct-mtl">
      <div class="col-md-2 control-label">
        <label for="recipientContent" class="control-label-required">{{ 'admin.operation_certificate.template.certificate.recipient'|trans }}：</label>
      </div>
      <div class="controls col-md-5">
        <input type="text" id="recipientContent" name="recipientContent" class="form-control" value="{{ template.recipientContent|default('admin.operation_certificate.template.certificate.recipient.default'|trans) }}">
        <p class="help-block">{{ 'admin.operation_certificate.template.certificate.recipient_hint'|trans|raw }}</p>
        <p class="help-block">{{ 'admin.operation_certificate.template.certificate.empty_recipient_hint'|trans|raw }}</p>
      </div>
    </div>
    <div class="form-group ct-mtl">
      <div class="col-md-2 control-label">
        <label for="certificateContent" class="control-label-required">{{ 'admin.operation_certificate.template.certificate.content'|trans }}：</label>
      </div>
      <div class="controls col-md-5">
        <textarea id="certificateContent" name="certificateContent" class="form-control" rows="4">{{ template.certificateContent|default(('admin.operation_certificate.template.certificate.content.default.'~template.targetType)|trans) }}</textarea>
        <p class="help-block">{{ 'admin.operation_certificate.template.certificate.content_hint'|trans|raw }}
          <br> {{ ('admin.operation_certificate.template.certificate.content_hint.'~template.targetType)|trans|raw }}
        </p>
      </div>
    </div>
    <div class="form-group ct-mtl">
      <div class="col-md-2 control-label">
        <label for="qrCodeSetting" class="control-label-required">{{ 'admin.operation_certificate.template.certificate.qrcode'|trans }}：</label>
      </div>
      <div class="controls col-md-2">
        <span class="es-switch {% if template.qrCodeSet|default(1) %}is-active{% endif %}" style="margin-top: 7px;">
        <input class="es-switch__input" type="text" id="qrCodeSet" name="qrCodeSet" value="{{ template.qrCodeSet|default(1) }}" data-close="0" data-open="1">
      </span>
      </div>
    </div>
    <div class="form-group ct-mtl">
      <div class="col-md-2 control-label">
      </div>
      <div class="controls col-md-8">
        <button type="button" class="btn btn-primary ct-mrl" id="update-certificate-template" data-submitting-text="{{ 'form.btn.save.submiting'|trans }}">{{ 'form.btn.save'|trans }}</button>
        <a class="btn btn-default ct-mrl" data-toggle="modal" data-target="#modal" data-url="{{ path('admin_v2_certificate_template_preview', {id: template.id}) }}" >{{ 'admin.operation_certificate.template.preview_btn'|trans }}</a>
        <a class="btn btn-default" href="{{ path('admin_v2_certificate_template_creat_step_three', {id: template.id}) }}">{{ 'form.btn.back'|trans }}</a>
      </div>
    </div>
    <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  </form>

{% endblock %}